//
//  HNSH_ChatReceiveRedCell.m
//  NongYe
//
//  Created by 李宇廷 on 2023/2/6.
//

#import "HNSH_ChatReceiveRedCell.h"

@interface HNSH_ChatReceiveRedCell ()

/* nameLabel */
@property (nonatomic, strong) UILabel *nameLabel;
/* timeLabel */
@property (nonatomic, strong) UILabel *timeLabel;
/* moneyLabel */
@property (nonatomic, strong) UILabel *moneyLabel;
/* lineView */
@property (nonatomic, strong) UIView *lineView;

@end

@implementation HNSH_ChatReceiveRedCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.backgroundColor = [UIColor whiteColor];
        [self configView];
    }
    return self;
}

- (void)configView {
    [self addAllViews];
    [self addAllLayout];
}

- (void)setModel:(HNSH_ChatRedRecordModel *)model {
    self.nameLabel.text = model.title;
    self.timeLabel.text = model.time_text;
    self.moneyLabel.text = model.amount_text;
}

- (void)addAllViews {
    self.contentView.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:self.nameLabel];
    [self.contentView addSubview:self.timeLabel];
    [self.contentView addSubview:self.moneyLabel];
    [self.contentView addSubview:self.lineView];
    
    
    
}

- (void)addAllLayout {
    [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16);
        make.top.mas_equalTo(12);
        make.height.mas_equalTo(20);
    }];
    
    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16);
        make.top.mas_equalTo(32);
        make.height.mas_equalTo(20);
    }];
    
    [self.moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-16);
        make.top.mas_equalTo(12);
        make.height.mas_equalTo(20);
    }];
    
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(16);
        make.right.mas_equalTo(-16);
        make.bottom.mas_equalTo(0);
        make.height.mas_equalTo(1);
    }];
}

#pragma mark lazy
- (UILabel *)nameLabel {
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.textColor = [UIColor colorWithHexString:@"#333333"];
        _nameLabel.font = [UIFont boldSystemFontOfSize:14];
    }
    return _nameLabel;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc]init];
        _timeLabel.textColor = [UIColor colorWithHexString:@"#999999"];
        _timeLabel.font = [UIFont systemFontOfSize:14];
    }
    return _timeLabel;
}

- (UILabel *)moneyLabel {
    if (!_moneyLabel) {
        _moneyLabel = [[UILabel alloc]init];
        _moneyLabel.textColor = [UIColor colorWithHexString:@"#333333"];
        _moneyLabel.font = [UIFont systemFontOfSize:14];
    }
    return _moneyLabel;
}

- (UIView *)lineView {
    if (!_lineView ) {
        _lineView = [[UIView alloc]init];
        _lineView.backgroundColor = [UIColor colorWithHexString:@"#F3F3F3"];
    }
    return _lineView;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
